<include file="../Public/_top" />
<div class="content">
  <div class="wrap">
      <div class="con_side">
          <ul class="nav">
              <li ><a href="{:U('public/Resources/index')}">培训资讯</a></li>
                <li class="cursor"><a href="{:U('public/Resources/TeacherResources')}">学习资源</a></li>
            </ul>
        </div>
        <div class="con_main">
          <div class="con_tit">
            <span style="font-weight:bold;color:#000;font-family:'新宋体'">{$type_name}</span>
            <ul class="con_tit_ul">
              <volist name="level" id="l" key="k" >
                <li>
                  <a href="javascript:;" style="background:#dcdcdd;" onclick="selectChildren(this);">{$l.name}</a>
                  <ul class="children">
                    <volist name="l['level']" id="sl" key="key" >
                      <li><a href="javascript:;" onclick="select_type(this,{$sl.id},{$l.id},{$k})">{$sl.name}</a></li>
                    </volist>
                  </ul>
                </li>
              </volist>
                <li>
                  <a href="javascript:;" style="background:#dcdcdd;" onclick="selectChildren(this);">资源类型</a>
                  <ul class="children">
                    <li><a href="javascript:;"onclick="select_category(this,1)">文档资源</a></li>
                    <li><a href="javascript:;"onclick="select_category(this,2)">视频资源</a></li>
                  </ul>
                </li>
                <li>
                  <input type="hidden" id="number{$d.id}">
                  <input type="hidden" id="resource_type{$d.id}">
                  <div href="javascript:;" onclick="select_filter({$d.id});" style="background:#f68d04;margin-left:15px;width:70px;text-align:center; color:#efefef;line-height: 45px;cursor:pointer;">确定</div>
                </li>
            </ul>
          </div>
          <div class="con_box">
            <ul class="learningList">
              <if condition="$data['data']">
                <volist name="data['data']" id="listData">
                  <li> 
                    <div class="pic">
                      <a href="{:U('public/Resources/view',array('id'=>$listData['id']))}">
                        <img src="{$listData.img_url}" />
                      </a>
                    </div>
                    <div style="margin-top:15px;margin-left:10px;">
                      <a href="{:U('public/Resources/view',array('id'=>$listData['id']))}" style="font-size:16px;" >《{$listData.resource_name}》
                      </a>
                    </div>
                    <div class="txt" style="margin-top:15px;margin-left:10px;font-size:14px;">
                      <span>{$listData['ctime']|date='Y/m/d',###}</span>
                      <if condition="$listData['category'] eq 1">文档资源<else/>视频资源</if>
                    </div>
                    <div class="stu" style="margin-top:15px;">
                      <span></span>{$listData.learn_sum}人已学
                    </div>
                  </li>
                </volist>
              <else/>
                暂无资源
              </if>
            </ul>
            <div class="pagebox">{$data.html}</div>
          </div>
           
        </div>
    </div>
</div>
<input type="hidden" id="category">
<input type="hidden" id="resource_teacher" >
<input type="hidden" id="type1">
<input type="hidden" id="type2">
<input type="hidden" id="id" value="{$id}">
<script>
  var type_id="<?php echo $id;?>";
  function select_type(cate,id,fid,key){
    $(cate).parent().nextAll().children().css('background','');
    $(cate).parent().prevAll().children().css('background','');
    $(cate).css('background','#f3a33a');
    if(fid==31 || fid==46){
      $("#resource_teacher").val("");
      $("#resource_teacher").val(id);
    }else{
      $("#type"+key).val("");
      str=type_id+"/"+fid+"/"+id;
      $("#type"+key).val(str);
    }
  }
  function select_category(cate,id){
    $(cate).parent().nextAll().children().css('background','');
    $(cate).parent().prevAll().children().css('background','');
    $(cate).css('background','#f3a33a');
    $("#category").val(id);
  }
  function select_filter(id){
    $(".children").css('display','none');
    category=$("#category").val();
    resource_type="";
    type1=$("#type1").val();
    type2=$("#type2").val();
    resource_teacher=$("#resource_teacher").val();
    id=$("#id").val();
    if(type1){
      resource_type=type1;
      if(type2){
        resource_type+=","+type2;
      }
    }else{
      if(type2){
        resource_type=type2;
      }
    }
    window.location.href="{:U('public/Resources/more')}"+"&id="+id+"&resource_type="+resource_type+"&resource_teacher="+resource_teacher+"&category="+category;
    // $.ajax({
    //     type: "get",
    //     url:"{:U('public/Resources/more')}",
    //     data:"category="+category+"&resource_type="+resource_type+"&resource_teacher="+resource_teacher+"&id="+id,
    //     dataType:"text",
    //     success:function(data){
    //       $("#resource_list"+id).html("");
    //       $("#resource_list"+id).append(data); 
    //     }
    //   });
  }
  function selectChildren(cate){
    $(".children").css('display','none');
    $(cate).next().css('display', 'block');
  }
</script>
<include file="../Public/_foot" />